/*
 * Wire
 * Copyright (C) 2018 Wire Swiss GmbH
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/.
 *
 */

// vars
@media-button-size: 32px;
@media-button-size-lg: 64px;

@keyframes progress-animation {
  to {
    stroke-dasharray: 100 100;
  }
}

@keyframes progress-animation-lg {
  to {
    stroke-dasharray: 200 200;
  }
}

// Buttons
.media-button {
  .circle(@media-button-size);
  background-color: fade(#000, 40%);
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: @font-size-sm;
  line-height: @media-button-size;
  text-align: center;
  position: relative;

  & svg {
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 50%;
    transform: rotate(-90deg);
  }

  & circle {
    fill: none;
    stroke-dasharray: 0 100; // radius * 2 + pi
    stroke-width: 4px;
    transform-origin: center;
  }

  .media-button-border-fill {
    .full-screen;
    border: 2px solid fade(#fff, 40%);
    border-radius: 50%;

    &::before {
      .full-screen;
      border: 1px solid #fff;
      border-radius: 50%;
      content: '';
    }
  }

  &.media-button-error {
    background-color: fade(@w-red, 24%);
  }

  &.media-button-progress-animation {
    & circle {
      animation: progress-animation @animation-timing-slower * 3 linear infinite;
    }
  }

  .media-button-lg & {
    .circle(@media-button-size-lg);
    font-size: @font-size-xl;
    line-height: @media-button-size-lg;

    & circle {
      stroke-dasharray: 0 200;
    }

    &.media-button-progress-animation {
      & circle {
        animation: progress-animation-lg @animation-timing-slower * 3 linear infinite;
      }
    }
  }
}
